package com.sertaogames.mundoj.servlet;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.sertaogames.mundoj.model.Compra;

public class LoadCompra extends BasicServlet {

	private static final long serialVersionUID = 1L;

	@Override
	protected void execute(HttpServletRequest req, HttpServletResponse resp) {
		
		Compra compra = jdo.findById(Compra.class, Long.valueOf(req.getParameter("id")));
		req.setAttribute("compra", compra);
		compra.loadJSON();
		
		try {
			getServletContext().getRequestDispatcher("/detalhe-compra.jsp").forward(req, resp);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}

}
